package com.ls.config.auth;


import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import com.ls.enums.RoleEnum;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.ls.enums.RoleEnum.STAFF;

/**
 * 权限类
 * 目前是4种角色，所以这里的List也是4个
 *
 * @author pengyu
 * 如果前端不需要看这里，那就不需要返回给前端权限列表。
 * TODO  前端需要看菜单，那就返回 list 即可，因为这次前端比较水，正常来说应该是 树形
 * SaTokenConfigure 这个累里面配置后，好像用不到这里的处理了
 */
@Component
public class PyPermission {

    public static final List<String> ADMIN_LIST = CollUtil.newArrayList(
            "/smsTemplate/pageList",
            "/smsTemplate/add",
            "/smsTemplate/edit",
            "/smsTemplate/audit",
            "/smsTemplate/del",
            "/feedbackRecord/pageList",
            "/orderRecord/pageList",
            "/orderRecord/refund",
            "/alipay/closeOrder",
            "/alipay/refundApply",
            "/customer/getSignList",
            "/customer/updateStatus",
            "/customer/getDataAge",
            "/customer/getPaging",
            "/user/getPaging",
            "/user/add",
            "/user/update",
            "/thali/getProduct",
            "/thali/edit",
            "/thali/add",
            "/banner/getBanner",
            "/banner/add",
            "/banner/edit",
            "/benefit/getPaging",
            "/holiday/getPaging",
            "/logistic/pageList",
            "/smsRecord/getPaging",
            "/isSend/getIsSend",
            "/yxSms/pageList",
            "/startBanner/pageList",
            "/activity/pageList",
            "/activityUser/pageList",
            "/version/pageList",
            "/inviteTemplate/pageList",
            "/example/pageList"
    );
    public static final List<String> STAFF_LIST = CollUtil.newArrayList(
            "/smsTemplate/pageList",
            "/smsTemplate/audit",
            "/feedbackRecord/pageList",
            "/orderRecord/pageList",
            "/alipay/closeOrder",
            "/customer/getSignList",
            "/customer/updateStatus",
            "/customer/getPaging",
            "/logistic/pageList",
            "/smsRecord/getPaging"
    );
//    public static final List<String> STAFF_LIST = CollUtil.newArrayList("1", "1", "3");
    public static final List<String> MEMBER_LIST = CollUtil.newArrayList("1", "1", "3");
    public static final List<String> COMMON_LIST = CollUtil.newArrayList("1", "1", "3");

//    public static final Map<RoleEnum, List<String>> ROLE_MAP = MapUtil.of(MapUtil.entry("key1", "value1"), MapUtil.entry("key2", "value2"));

//    public static final Map<RoleEnum, List<String>> ROLE_MAP = MapUtil.of(RoleEnum.ADMIN,ADMIN_LIST,RoleEnum.STAFF,STAFF_LIST);

    public static final Map<RoleEnum, List<String>> ROLE_MAP = new HashMap<RoleEnum, List<String>>() {
        {
            put(RoleEnum.ADMIN, ADMIN_LIST);
            put(RoleEnum.STAFF, STAFF_LIST);
            put(RoleEnum.MEMBER, MEMBER_LIST);
            put(RoleEnum.COMMON, COMMON_LIST);
        }
    };

//    @PostConstruct
//    public void init() {
//        ROLE_MAP.put(RoleEnum.ADMIN,ADMIN_LIST);
//        ROLE_MAP.put(RoleEnum.ADMIN,ADMIN_LIST)
//        ROLE_MAP.put(RoleEnum.ADMIN,ADMIN_LIST)
//        ROLE_MAP.put(RoleEnum.ADMIN,ADMIN_LIST)
//    }


}
